package com.zwface.demo.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.zwface.demo.model.db.Attendance;
import com.zwface.demo.model.db.Course;
import com.zwface.demo.model.db.JoinUserWithCourse;
import com.zwface.demo.model.db.Leave;
import com.zwface.demo.model.db.UserInfo;

import com.zwface.demo.greendao.AttendanceDao;
import com.zwface.demo.greendao.CourseDao;
import com.zwface.demo.greendao.JoinUserWithCourseDao;
import com.zwface.demo.greendao.LeaveDao;
import com.zwface.demo.greendao.UserInfoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig attendanceDaoConfig;
    private final DaoConfig courseDaoConfig;
    private final DaoConfig joinUserWithCourseDaoConfig;
    private final DaoConfig leaveDaoConfig;
    private final DaoConfig userInfoDaoConfig;

    private final AttendanceDao attendanceDao;
    private final CourseDao courseDao;
    private final JoinUserWithCourseDao joinUserWithCourseDao;
    private final LeaveDao leaveDao;
    private final UserInfoDao userInfoDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        attendanceDaoConfig = daoConfigMap.get(AttendanceDao.class).clone();
        attendanceDaoConfig.initIdentityScope(type);

        courseDaoConfig = daoConfigMap.get(CourseDao.class).clone();
        courseDaoConfig.initIdentityScope(type);

        joinUserWithCourseDaoConfig = daoConfigMap.get(JoinUserWithCourseDao.class).clone();
        joinUserWithCourseDaoConfig.initIdentityScope(type);

        leaveDaoConfig = daoConfigMap.get(LeaveDao.class).clone();
        leaveDaoConfig.initIdentityScope(type);

        userInfoDaoConfig = daoConfigMap.get(UserInfoDao.class).clone();
        userInfoDaoConfig.initIdentityScope(type);

        attendanceDao = new AttendanceDao(attendanceDaoConfig, this);
        courseDao = new CourseDao(courseDaoConfig, this);
        joinUserWithCourseDao = new JoinUserWithCourseDao(joinUserWithCourseDaoConfig, this);
        leaveDao = new LeaveDao(leaveDaoConfig, this);
        userInfoDao = new UserInfoDao(userInfoDaoConfig, this);

        registerDao(Attendance.class, attendanceDao);
        registerDao(Course.class, courseDao);
        registerDao(JoinUserWithCourse.class, joinUserWithCourseDao);
        registerDao(Leave.class, leaveDao);
        registerDao(UserInfo.class, userInfoDao);
    }
    
    public void clear() {
        attendanceDaoConfig.clearIdentityScope();
        courseDaoConfig.clearIdentityScope();
        joinUserWithCourseDaoConfig.clearIdentityScope();
        leaveDaoConfig.clearIdentityScope();
        userInfoDaoConfig.clearIdentityScope();
    }

    public AttendanceDao getAttendanceDao() {
        return attendanceDao;
    }

    public CourseDao getCourseDao() {
        return courseDao;
    }

    public JoinUserWithCourseDao getJoinUserWithCourseDao() {
        return joinUserWithCourseDao;
    }

    public LeaveDao getLeaveDao() {
        return leaveDao;
    }

    public UserInfoDao getUserInfoDao() {
        return userInfoDao;
    }

}
